package so.wy.servicecenter.businessbed.service.pay.dto;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.NoArgsConstructor;
import so.wy.servicecenter.businessbed.dao.rdb.pay.PayDO;

import java.util.Date;

/**
* @author wdl
* @date 2020-04-08
*/
@Data
@NoArgsConstructor
public class PayDTO{

	/** 流水ID */
	private Long id;
	/** 收入、支出 */
	private Integer payType;
	/** 流水类型 1充值 2提现 3支付 */
	private Integer transactionType;
	/** 业务类型 */
	private Integer businessType;
	/** 业务标识 */
	private String businessSign;
	/** 预支付单号 */
	private String preOrderSerial;
	/** 支付方名称 */
	private String payerName;
	/** 收款方名称 */
	private String receiverName;
	/** 支付描述 */
	private String payDesc;
	/** 支付时间 */
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
	private Date optTime;
	/** 交易金额 */
	private Double transactionAmount;
	/** 支付状态 1待处理 2成功 3失败 */
	private Integer payStatus;
	/** 租户ID */
	private Long rentUserId;
	/** 排序 */
	private Integer sortNum;

	public PayDTO(PayDO payDO){
		if(payDO==null){
			return ;
		}

		this.id = payDO.getId();
		this.payType = payDO.getPayType();
		this.transactionType = payDO.getTransactionType();
		this.businessType = payDO.getBusinessType();
		this.businessSign = payDO.getBusinessSign();
		this.preOrderSerial = payDO.getPreOrderSerial();
		this.payerName = payDO.getPayerName();
		this.receiverName = payDO.getReceiverName();
		this.payDesc = payDO.getPayDesc();
		this.optTime = payDO.getOptTime();
		this.transactionAmount = payDO.getTransactionAmount();
		this.payStatus = payDO.getPayStatus();
		this.rentUserId = payDO.getRentUserId();
		this.sortNum = payDO.getSortNum();
	}

	public PayDO convert2DO(){
		PayDO payDO = new PayDO();
		payDO.setId(this.id);
		payDO.setPayType(this.payType);
		payDO.setTransactionType(this.transactionType);
		payDO.setBusinessType(this.businessType);
		payDO.setBusinessSign(this.businessSign);
		payDO.setPreOrderSerial(this.preOrderSerial);
		payDO.setPayerName(this.payerName);
		payDO.setReceiverName(this.receiverName);
		payDO.setPayDesc(this.payDesc);
		payDO.setOptTime(this.optTime);
		payDO.setTransactionAmount(this.transactionAmount);
		payDO.setPayStatus(this.payStatus);
		payDO.setRentUserId(this.rentUserId);
		payDO.setSortNum(this.sortNum);
		return payDO;
	}

}
